package top.hidoctor.auscultation.adapter;

import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tang.util.DensityUtil;

import java.util.List;

import top.hidoctor.auscultation.R;
import top.hidoctor.auscultation.bean.AnalysisBean;

public class GailvAdapter extends BaseQuickAdapter<AnalysisBean> {
    public GailvAdapter(int layoutResId, List<AnalysisBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AnalysisBean item) {
        helper.setText(R.id.tv_name, item.getName());
        helper.setText(R.id.tv_gl, item.getGl());
        View view = helper.getView(R.id.view);
        int withd = mContext.getResources().getDisplayMetrics().widthPixels - DensityUtil.dip2px(mContext, 140);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(withd * Integer.valueOf(item.getGl().split("%")[0]) / 100, DensityUtil.dip2px(mContext, 25));
        params.leftMargin = DensityUtil.dip2px(mContext, 40);
        params.addRule(RelativeLayout.CENTER_VERTICAL);
        view.setLayoutParams(params);

    }
}
